<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title> {$setting.webname}- 报名记录</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="/public/static/favicon.ico">

    <link href="/public/static/admin/layui/css/layui.css" rel="stylesheet">
    <link href="/public/static/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/public/static/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="/public/static/admin/css/animate.css" rel="stylesheet">
    <link href="/public/static/admin/css/plugins/footable/footable.core.css" rel="stylesheet">
    <link href="/public/static/admin/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="/public/static/admin/css/plugins/switchery/switchery.css" rel="stylesheet">


</head>

<body class="gray-bg">
<div class="row wrapper border-bottom white-bg page-heading">
    <div class="col-sm-4">
        <h2>报名记录</h2>
        <ol class="breadcrumb">
            <li>
                <a href="{:url('Admins/admin')}">主页</a>
            </li>
            <li>
                <strong>报名列表</strong>
            </li>
        </ol>
    </div>
    <div class="col-sm-8" style="text-align: right;line-height: 15px;margin-top:25px;">

    </div>
</div>
<div class="wrapper wrapper-content animated fadeIn">
    <div class="row">
        <div class="col-sm-12">
            <div class="tabs-container">
                <div class="panel-body">
                    <div class="table-responsive">
                        <table class="footable table table-stripped toggle-arrow-tiny" data-page-size="15">
                            <thead>
                            <tr>
                                <th data-toggle="true">姓名</th>
                                <th>电话</th>
                                <th>学员性质</th>
                                <th>报名课程</th>
                                <th>状态</th>
                                <th>操作</th>
                                <th data-hide="all">学员ID号</th>
                                <th data-hide="all">班级ID号</th>
                                <th data-hide="all">报名时间</th>
                                <th data-hide="all">修改时间</th>
                                <th data-hide="all">身份证号</th>
                                <th data-hide="all">户籍地址</th>
                            </tr>
                            </thead>
                            <tbody>
                            {foreach $newslist as $vs}
                            <!--行开始-->
                            <tr>
                                <td>{$vs.username}</td>
                                <td>{$vs.phone}</td>
                                <td>{$vs.natrue}</td>
                                <td>{$vs.course}</td>
                                <td>
                                    {if condition="$vs.status==1"}
                                    <span style="color:#f8ac59"><i class="fa fa-thumb-tack"></i> 审核中</span>
                                    {elseif condition="$vs.status==2" /}
                                    <span style="color:green"><i class="fa fa-check"></i> 通过</span>
                                    {elseif condition="$vs.status==4" /}
                                    <span style="color:#d9534f;"><i class="fa fa-times"></i> 拒绝</span>
                                    {/if}
                                </td>

                                <td class="tools">
                                    <a href="{:url('Applys/update')}?id={$vs.id}"><i class="fa fa-pencil"
                                                                                     style="color:#19a9d5"></i></a>
                                    <a class="check" data-courseid="{$vs.courseid}" data-username="{$vs.username}"
                                       data-courses="{$vs.course}" data-times="{$vs.create_time}" data-id="{$vs.id}"
                                       data-type="{$vs.type}"><i class="fa fa-check" style="color:#19a9d5"></i></a>
                                    <a class="checks" data-courseid="{$vs.courseid}" data-username="{$vs.username}"
                                       data-courses="{$vs.course}" data-photo="{$vs.identification_photo}"  data-times="{$vs.create_time}" data-id="{$vs.id}"
                                       data-type="{$vs.type}"><i class="fa fa-upload" style="color:#19a9d5"></i></a>
                                    <!--<a class="times" data-id="{$vs.id}" data-type="{$vs.type}"><i class="fa fa-times" style="color:#19a9d5"></i></a>-->
                                    <!--<a class="del" data-id="{$vs.id}" data-type="{$vs.type}"><i class="fa fa-trash" style="color:#19a9d5"></i></a>-->
                                </td>
                                <!--隐藏起来的列表信息-->
                                <td>{$vs.id}</td>
                                <td>{$vs.classid}</td>
                                <td>{$vs.create_time}</td>
                                <td>{$vs.update_time}</td>
                                <td>{$vs.idcard}</td>
                                <td>{$vs.province}{$vs.city}{$vs.district}{$vs.detailmap}</td>
                                <td>{$vs.reason}</td>

                            </tr>
                            <!--行结束-->
                            {/foreach}
                            </tbody>
                            <tfoot>
                            <tr>
                                <td colspan="6">
                                    <ul class="pagination pull-right"></ul>
                                </td>
                            </tr>
                            </tfoot>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>

</div>
<!--弹出层-->
<style>
    .layer_notice {
        width: 450px;
        margin: 50px auto;
        line-height: 30px;
        display: none;
    }

    .layer_notice select {
        height: 35px;
    }

    .layer_notices {
        width: 450px;
        margin: 50px auto;
        line-height: 30px;
        display: none;
    }
</style>
<div class="layer_notice">
    <div class="row">
        <label class="col-sm-3" style="text-align: right;font-size:16px;">姓名：</label>
        <div class="col-sm-9" id="usernames"></div>
    </div>
    <div class="row">
        <label class="col-sm-3" style="text-align: right;font-size:16px;">课程：</label>
        <div class="col-sm-9" id="courses"></div>
    </div>
    <div class="row">
        <label class="col-sm-3" style="text-align: right;font-size:16px;">报名时间：</label>
        <div class="col-sm-9" id="times"></div>
    </div>
    <div class="row">
        <label class="col-sm-3" style="text-align: right;font-size:16px;">选择班级：</label>
        <div class="col-sm-9">
            <select class="form-control m-b" name="nature" id="nature">
                {foreach $class as $k=>$v}
                <option value="{$v.classid}">{$v.classid}</option>
                {/foreach}
            </select>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-12" style="text-align: right;">
            <button class="btn" id="closes">取消</button>
            <button class="btn btn-info" id="classAddStudent">保存</button>
        </div>
    </div>
</div>

<div class="layer_notices">
    <div class="row">
        <label class="col-sm-3" style="text-align: right;font-size:16px;">姓名：</label>
        <div class="col-sm-9" id="username"></div>
    </div>
    <div class="row">
        <label class="col-sm-3" style="text-align: right;font-size:16px;">课程：</label>
        <div class="col-sm-9" id="course"></div>
    </div>
    <div class="row">
        <label class="col-sm-3" style="text-align: right;font-size:16px;">报名时间：</label>
        <div class="col-sm-9" id="time"></div>
    </div>
    <div class="row">
        <label class="col-sm-3" style="text-align: right;font-size:16px;">证书编号：</label>
        <div class="col-sm-9">
            <input type="text" placeholder="请输入证书编号" id="number" class="form-control">
        </div>
    </div>
    <div class="row">
        <label class="col-sm-3" style="text-align: right;font-size:16px;">学生照片：</label>
        <div class="col-sm-9">
            <!-- 上传图片开始 -->
            <button type="button" class="btn btn-info" id="test1">选择图片</button>
            <div class="layui-upload-list">
                <img class="layui-upload-img" width="200px" id="demo1">
                <input type="hidden" name="photo" id="photo">
                <p id="demoText"></p>
            </div>
            <!-- 上传图片 -->
        </div>
    </div>
    <div class="row">
        <!--<label class="col-sm-3" style="text-align: right;font-size:16px;"></label>-->
        <div class="col-sm-12" style="font-size:16px;">
            学生上传照片应为学生本人近期正面免冠彩色证件照。照片图像大小最小为192*144（高*宽），彩色，成像区大小为48mm*33mm(高*宽)。照片要求存储为jpg格式，图像文件名为*.jpg，照片大小：20-200KB。学生应上传本人清晰、正置的照片，不允许上传侧置或倒置的照片。
        </div>
    </div>


    <div class="row">
        <div class="col-sm-12" style="text-align: right;">
            <button class="btn" id="close">取消</button>
            <button class="btn btn-info" id="classAddcertificate">保存</button>
        </div>
    </div>
</div>
<!--弹出层-->
<!-- 全局js -->
<script src="/public/static/admin/js/jquery.min.js?v=2.1.4"></script>
<script src="/public/static/admin/js/bootstrap.min.js?v=3.3.6"></script>

<!-- iCheck -->
<script src="/public/static/admin/js/plugins/iCheck/icheck.min.js"></script>
<!-- Switchery -->
<script src="/public/static/admin/js/plugins/switchery/switchery.js"></script>

<!-- 自定义js -->
<script src="/public/static/admin/js/content.js?v=1.0.0"></script>
<script src="/public/static/admin/layui/layui.js"></script>
<script src="/public/static/admin/js/plugins/footable/footable.all.min.js"></script>
<script>
    $(document).ready(function () {
        $('.footable').footable();
    });
    layui.use(['layer', 'upload'], function () { //独立版的layer无需执行这一句
        var $ = layui.jquery, layer = layui.layer, upload = layui.upload; //独立版的layer无需执行这一句
        //点击提交
        $(".del").click(function () {
            var s = $(this);
            top.layer.msg('你确定要删除？', {
                time: 20000, //20s后自动关闭
                shade: 0.8,
                btn: ['确定', '取消'],
                btn1: function () {
                    $.post("{:url('Applys/deletes')}", {
                        id: s.attr('data-id'),
                        typeid: s.attr('data-typeid')
                    }, function (data) {
                        top.layer.closeAll();
                        top.layer.msg(data.msg, {time: 2000,shade:0.5}, function () {
                            if (data.url) {
                                window.location.href = data.url;
                            }
                        });
                    });
                }
            });
        });
        //拒绝
        $(".times").click(function () {
            var s = $(this);
            layer.prompt({title: '请输入拒绝理由', formType: 2}, function (text) {
                if (text != "") {
                    $.post("{:url('Applys/times')}", {
                        reason: text,
                        id: s.attr('data-id'),
                        typeid: s.attr('data-typeid')
                    }, function (data) {
                        top.layer.closeAll();
                        top.layer.msg(data.msg, {time: 2000,shade:0.5}, function () {
                            if (data.url) {
                                window.location.href = data.url;
                            }
                        });
                    });
                }
            });
        });
        //通过
        $(".check").click(function () {
            var s = $(this);
            $("#usernames").text(s.attr("data-username"));
            $("#courses").text(s.attr("data-courses"));
            $("#times").text(s.attr("data-times"));
            $("#classAddStudent").attr("data-id", s.attr("data-id"));
            $.post("{:url('Applys/selectClass')}", {id: s.attr("data-courseid")}, function (data) {
                $("#natures").html(data.msg);
            });
            //页面层
            layer.open({
                type: 1,
                skin: false, //加上边框
                area: ['500px', 'AUTO'], //宽高
                content: $(".layer_notice")  //调到新增页面
            });
        });

        $("#closes").click(function () {
            top.layer.closeAll();
        });

        $("#classAddStudent").click(function () {
            var s = $(this);
            console.log(s.attr('data-id'));
            console.log($("#nature").val());
            if ($("#nature").val() != "") {
                $.post("{:url('Applys/classAddStudent')}", {
                    id: s.attr('data-id'),
                    classid: $("#nature").val()
                }, function (data) {
                    top.layer.closeAll();
                    top.layer.msg(data.msg, {time: 2000,shade:0.5}, function () {
                        if (data.url) {
                            window.location.href = data.url;
                        }
                    });
                })
            } else {
                top.layer.msg("请选择班级", {time: 2000,shade:0.5});
            }
        });


        /*下发证书*/
        $(".checks").click(function () {
            var s = $(this);
            $("#username").text(s.attr("data-username"));
            $("#course").text(s.attr("data-courses"));
            $("#photo").val(s.attr("data-photo"));
            $("#demo1").attr('src',s.attr("data-photo"));
            $("#time").text(s.attr("data-times"));
            $("#classAddcertificate").attr("data-id", s.attr("data-id"));
            $.post("{:url('Applys/selectClass')}", {id: s.attr("data-courseid")}, function (data) {
                $("#nature").html(data.msg);
            });
            //页面层
            layer.open({
                type: 1,
                skin: false, //加上边框
                area: ['500px', 'AUTO'], //宽高
                content: $(".layer_notices")  //调到新增页面
            });
        });
        //关闭弹出层
        $("#close").click(function () {
            top.layer.closeAll();
        });
        $("#classAddcertificate").click(function () {
            var s = $(this);
            var photo = $('#photo').val();
            var number = $('#number').val();
            if (number != '') {
                if (photo != '') {
                        $.post("{:url('Myclasss/AddCertificate')}", {
                            id: s.attr('data-id'),
                            photo: photo,
                            number: number
                    }, function (data) {
                        top.layer.closeAll();
                        top.layer.msg(data.msg, {time: 2000,shade:0.5}, function () {
                            if (data.url) {
                                window.location.href = data.url+'?classid={$classid}';
                            }
                        });
                    })
                } else {
                    top.layer.msg("请上传学生照片！", {time: 2000,shade:0.5});
                }

            } else {
                top.layer.msg("请填写证书编号！", {time: 2000,shade:0.5});
            }
        });
        //普通图片上传
        var uploadInst = upload.render({
            elem: '#test1'
            , url: "{:url('Myclasss/upload_identification')}"
            , before: function (obj) {
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                    $('#demo1').attr('src', result); //图片链接（base64）
                });
            }
            , done: function (res) {
                //如果上传失败
                if (res.code == 0) {
                    return top.layer.msg('上传失败',{shade:0.5});
                } else if (res.code) {
                    //上传成功
                    $('#photo').val('/public/static/admin/uploads/student/' + res.photo);
                    return top.layer.msg('上传成功',{shade:0.5});
                }
            }
            , error: function () {
                //演示失败状态，并实现重传
                var demoText = $('#demoText');
                demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
                demoText.find('.demo-reload').on('click', function () {
                    uploadInst.upload();
                });
            }
        });
    });
    $(document).ready(function () {
        $('.i-checks').iCheck({
            checkboxClass: 'icheckbox_square-green',
            radioClass: 'iradio_square-green',
        });
    });
    //状态的切换按钮的初始化样式
    var elems = Array.prototype.slice.call(document.querySelectorAll('.js-switch'));
    elems.forEach(function (html) {
        var switchery = new Switchery(html, {size: 'small'});
    });
    //修改状态
    $(".js-switch").change(function () {
        var checkedS = $(this).is(":checked");
        var ids = $(this).attr("data-id");
        var st = "";
        var str = "";
        if (checkedS) {
            st = 1;
            str = "显示";
        } else {
            st = 2;
            str = "隐藏";
        }
        $.post("{:url('Users/setStatus')}", {id: ids, status: st}, function (data) {

            layer.msg(str + data.msg, {time: 2000,shade:0.5});
        });
    });
</script>


</body>

</html>
